import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:myflutterproject/routes.dart';
import 'package:myflutterproject/utils/overScrollBehavior.dart';
/*
* Widgets 目录
* */
class BaseCatalogWidgets extends StatefulWidget{
  @override
  State<StatefulWidget> createState() =>BaseCatalogState();
}

class BaseCatalogState extends State<BaseCatalogWidgets>{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Widgets 目录'),
        centerTitle: true,
      ),
      body: Center(
        child: ScrollConfiguration(
          behavior: OverScrollBehavior(),
          child: ListView(
            children: <Widget>[
              ItemButton('基础组件', basewidgets),
              ItemButton('Material Components Widgets', basematerialwidgets),
              ItemButton('Cupertino (iOS风格) Widgets', cupertinowidgets),
              ItemButton('布局', widgetsdemo),
              ItemButton('文本 Widget', textwidgets),
              ItemButton('Assets、图片、Icons', picsdemo),
              ItemButton('Input', picsdemo),
              ItemButton('动画和Motion', animations),
              ItemButton('交互模型', interactionmodelwidgets),
              ItemButton('样式', interactionmodelwidgets),
              ItemButton('绘制和效果', drawandeffect),
              ItemButton('Async', asyncwidgets),
              ItemButton('滚动', scrollwidgets),
            ],
          ),
        ),
      ),
    );
  }
}

class ItemButton extends StatelessWidget{
  final String name;
  final String route;

  ItemButton(this.name, this.route);

  @override
  Widget build(BuildContext context) {
    return FlatButton(
        onPressed: ()=>Navigator.pushNamed(context, route), 
        child: Text(name,style: TextStyle(fontSize: 20,color: Colors.blue),));
  }
  
}